import sqlite3

firstdb = sqlite3.connect('Test.db')
# 查询语句
query_sql = "select * from info"
for result in firstdb.execute(query_sql):
    print(result)

# 删除特定数据
delete_sql = "delete from info where id = 1 "
firstdb.execute(delete_sql)
firstdb.commit()

# 查询并输出
query_sql = "select * from info"
for result in firstdb.execute(query_sql):
    print(result)

# 插入数据
insert_sql = "insert into info(title, content, author) values ('第{}个标题', '随机的第{}个内容', '匿名')"
for i in range(10, 20):
    sql = insert_sql.format(i, i * 2)
    firstdb.execute(sql)
    firstdb.commit()

# 查询并输出
query_sql = "select * from info"
for result in firstdb.execute(query_sql):
    print(result)

# 更新数据
update_sql = "update info set author = '不匿名' where id >= 4"
firstdb.execute(update_sql)

# 查询并输出
query_sql = "select * from info"
for result in firstdb.execute(query_sql):
    print(result)